function Playerequipmenu()  
{
  RenderMap();
  
  WindowStyle.drawWindow(8, 8, 100, 12);
  Font.drawText(10, 10, "Equip What?");

  var Playerequtypemenu = new Menu();
  Playerequtypemenu.font         = Font;
  Playerequtypemenu.window_style = WindowStyle;
  Playerequtypemenu.arrow        = Arrow;
  Playerequtypemenu.addItem("Weapon",  Playerequweapon);
  Playerequtypemenu.addItem("Armour",  Playerequarmour);
  Playerequtypemenu.addItem("Cancel" , Playerequexit);
  Playerequtypemenu.execute(6, 34, 72, 40);
}
function Playerequexit()
{
GameMenu();
}

function Playerequweapon()
{
  RenderMap();
  WindowStyle.drawWindow(8, 8, 90, 12);
  Font.drawText(10, 10, "Equip What?");

  var Playerequmenuwep = new Menu();
  Playerequmenuwep.font         = Font;
  Playerequmenuwep.window_style = WindowStyle;
  Playerequmenuwep.arrow        = Arrow;
  Playerequmenuwep.addItem("Nothing",  PlayerequweaponNothing);
  if (Playerweapons.Dagger >= 1)
  {
  Playerequmenuwep.addItem("Dagger: " + Playerweapons.Dagger,  PlayerequweaponDagger);
  }
  if (Playerweapons.Dirk >= 1)
  {
  Playerequmenuwep.addItem("Dirk: " + Playerweapons.Dirk,  PlayerequweaponDirk);
  }
  if (Playerweapons.Short_Sword >= 1)
  {
  Playerequmenuwep.addItem("Short Sword: " + Playerweapons.Short_Sword,  PlayerequweaponShort_Sword);
  }
  if (Playerweapons.MithrilKnife >= 1)
  {
  Playerequmenuwep.addItem("Mithril Knife: " + Playerweapons.MithrilKnife,  PlayerequweaponMithrilKnife);
  }
  if (Playerweapons.ConqudorKnife >= 1)
  {
  Playerequmenuwep.addItem("Conqudor Knife: " + Playerweapons.ConqudorKnife,  PlayerequweaponConqudorKnife);
  }
  if (Playerweapons.Long_Sword >= 1)
  {
  Playerequmenuwep.addItem("Long Sword: " + Playerweapons.Long_Sword,  PlayerequweaponLong_Sword);
  }
  if (Playerweapons.BroadSword >= 1)
  {
  Playerequmenuwep.addItem("Broad Sword: " + Playerweapons.BroadSword,  PlayerequweaponBroad_Sword);
  }
  if (Playerweapons.RegalSword >= 1)
  {
  Playerequmenuwep.addItem("Regal Sword: " + Playerweapons.RegalSword,  PlayerequweaponRegalSword);
  }
  if (Playerweapons.MithrilBlade >= 1)
  {
  Playerequmenuwep.addItem("Mithril Blade: " + Playerweapons.MithrilBlade,  PlayerequweaponMithrilBlade);
  }
  if (Playerweapons.AdamantineBlade >= 1)
  {
  Playerequmenuwep.addItem("Adamantine Blade: " + Playerweapons.AdamantineBlade,  PlayerequweaponAdamantineBlade);
  }
  if (Playerweapons.LegendSword >= 1)
  {
  Playerequmenuwep.addItem("Legend Sword: " + Playerweapons.LegendSword,  PlayerequweaponLegendSword);
  }

  if (Playerweapons.WoodenStaff >= 1)
  {
  Playerequmenuwep.addItem("Wooden Staff: " + Playerweapons.WoodenStaff,  PlayerequweaponWoodenStaff);
  }
  if (Playerweapons.BattleStaff >= 1)
  {
  Playerequmenuwep.addItem("Battle Staff: " + Playerweapons.BattleStaff,  PlayerequweaponBattleStaff);
  }
  if (Playerweapons.MetalStaff >= 1)
  {
  Playerequmenuwep.addItem("Metal Staff: " + Playerweapons.MetalStaff,  PlayerequweaponMetalStaff);
  }
  if (Playerweapons.MageStaff >= 1)
  {
  Playerequmenuwep.addItem("Mage Staff: " + Playerweapons.MageStaff,  PlayerequweaponMageStaff);
  }
  Playerequmenuwep.addItem("Cancel", Playerequwepexit);

  Playerequmenuwep.execute(6, 34, 272, 160);
}
function Playerequwepexit()
{
GameMenu();
}

function PlayerequweaponNothing()
{
Player.equipweptemp = "Empty";
Player.weaponeffecttemp = 0;
Player.magicattacktemp = 0;
Player.weapontempthing = "blank";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponDagger()
{
Playerweapons.Dagger = Playerweapons.Dagger - 1;
Player.equipweptemp = "Dagger";
Player.weaponeffecttemp = 5;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon1";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponDirk()
{
Playerweapons.Dirk = Playerweapons.Dirk - 1;
Player.equipweptemp = "Dirk";
Player.weaponeffecttemp = 10;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon1";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponShort_Sword()
{
Playerweapons.Short_Sword = Playerweapons.Short_Sword - 1;
Player.equipweptemp = "Short Sword";
Player.weaponeffecttemp = 15;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon1";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponMithrilKnife()
{
Playerweapons.MithrilKnife = Playerweapons.MithrilKnife - 1;
Player.equipweptemp = "Mithril Knife";
Player.weaponeffecttemp = 45;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon1";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponConqudorKnife()
{
Playerweapons.ConqudorKnife = Playerweapons.ConqudorKnife - 1;
Player.equipweptemp = "Conqudor Knife";
Player.weaponeffecttemp = 75;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon1";
PlayerEquipWepPerson();
Menu_Status();
}

function PlayerequweaponLong_Sword()
{
CheckEquipAbiltiy("Mage");

  if (Player.checkequip == false)
  {
  Playerweapons.Long_Sword = Playerweapons.Long_Sword - 1;
  Player.equipweptemp = "Long Sword";
  Player.weaponeffecttemp = 25;
  Player.magicattacktemp = 0;
  Player.weapontempthing = "Weapon";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequweaponBroad_Sword()
{
CheckEquipAbiltiy("Mage");

  if (Player.checkequip == false)
  {
  Playerweapons.BroadSword = Playerweapons.BroadSword - 1;
  Player.equipweptemp = "Broad Sword";
  Player.weaponeffecttemp = 35;
  Player.magicattacktemp = 0;
  Player.weapontempthing = "Weapon";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequweaponRegalSword()
{
CheckEquipAbiltiy("Mage");

  if (Player.checkequip == false)
  {
  Playerweapons.RegalSword = Playerweapons.RegalSword - 1;
  Player.equipweptemp = "Regal Sword";
  Player.weaponeffecttemp = 65;
  Player.magicattacktemp = 0;
  Player.weapontempthing = "Weapon";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequweaponMithrilBlade()
{
CheckEquipAbiltiy("Mage");

  if (Player.checkequip == false)
  {
  Playerweapons.MithrilBlade = Playerweapons.MithrilBlade - 1;
  Player.equipweptemp = "Mithril Blade";
  Player.weaponeffecttemp = 80;
  Player.magicattacktemp = 0;
  Player.weapontempthing = "Weapon";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequweaponAdamantineBlade()
{
CheckEquipAbiltiy("Bard");

  if (Player.checkequip == false)
  {
  Playerweapons.AdamantineBlade = Playerweapons.AdamantineBlade - 1;
  Player.equipweptemp = "Adamantine Blade";
  Player.weaponeffecttemp = 125;
  Player.magicattacktemp = 0;
  Player.weapontempthing = "Weapon";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}

function PlayerequweaponLegendSword()
{
CheckEquipAbiltiy("Bard");

  if (Player.checkequip == false)
  {
  Playerweapons.LegendSword = Playerweapons.LegendSword - 1;
  Player.equipweptemp = "Legend Sword";
  Player.weaponeffecttemp = 200;
  Player.magicattacktemp = 0;
  Player.weapontempthing = "Weapon";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequweaponWoodenStaff()
{
Playerweapons.WoodenStaff = Playerweapons.WoodenStaff - 1;
Player.equipweptemp = "Wooden Staff";
Player.weaponeffecttemp = 12;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon2";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponBattleStaff()
{
Playerweapons.BattleStaff = Playerweapons.BattleStaff - 1;
Player.equipweptemp = "Battle Staff";
Player.weaponeffecttemp = 36;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon2";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponMetalStaff()
{
Playerweapons.MetalStaff = Playerweapons.MetalStaff - 1;
Player.equipweptemp = "Metal Staff";
Player.weaponeffecttemp = 57;
Player.magicattacktemp = 0;
Player.weapontempthing = "Weapon2";
PlayerEquipWepPerson();
Menu_Status();
}
function PlayerequweaponMageStaff()
{
CheckEquipAbiltiy("Mage Only");
  if (Player.checkequip == true)
  {
  Playerweapons.MageStaff = Playerweapons.MageStaff - 1;
  Player.equipweptemp = "Mage Staff";
  Player.weaponeffecttemp = 12;
  Player.magicattacktemp = 0.5;
  Player.weapontempthing = "Weapon2";
  PlayerEquipWepPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}


//Equip Armour......
function Playerequarmour()
{
  RenderMap();
  WindowStyle.drawWindow(8, 8, 100, 12);
  Font.drawText(10, 10, "Equip What?");

  // execute the menu
  var Playerequmenuarm = new Menu();
  Playerequmenuarm.font         = Font;
  Playerequmenuarm.window_style = WindowStyle;
  Playerequmenuarm.arrow        = Arrow;
  Playerequmenuarm.addItem("Nothing",  PlayerequarmNothing);
  if (Playerweapons.Lh_Armour >= 1)
  {
  Playerequmenuarm.addItem("Leather Armour: " + Playerweapons.Lh_Armour,  PlayerequarmLh_Armour);
  }
  if (Playerweapons.StudLh_Armour >= 1)
  {
  Playerequmenuarm.addItem("Studded Leather Armour: " + Playerweapons.StudLh_Armour,  PlayerequarmStudLh_Armour);
  }
  if (Playerweapons.IronPlate >= 1)
  {
  Playerequmenuarm.addItem("Iron Plate: " + Playerweapons.IronPlate,  PlayerequarmIronPlate);
  }
  if (Playerweapons.SilverVest >= 1)
  {
  Playerequmenuarm.addItem("Silver Vest: " + Playerweapons.SilverVest,  PlayerequarmSilverVest);
  }
  if (Playerweapons.SilverPlate >= 1)
  {
  Playerequmenuarm.addItem("Silver Plate: " + Playerweapons.SilverPlate,  PlayerequarmSilverPlate);
  }
  if (Playerweapons.SteelPlate >= 1)
  {
  Playerequmenuarm.addItem("Steel Plate: " + Playerweapons.SteelPlate,  PlayerequarmSteelPlate);
  }
  if (Playerweapons.BronzeVest >= 1)
  {
  Playerequmenuarm.addItem("Bronze Vest: " + Playerweapons.BronzeVest,  PlayerequarmBronzeVest);
  }
  if (Playerweapons.BronzePlate >= 1)
  {
  Playerequmenuarm.addItem("Bronze Plate: " + Playerweapons.BronzePlate,  PlayerequarmBronzePlate);
  }
  if (Playerweapons.MithrilVest >= 1)
  {
  Playerequmenuarm.addItem("Mithril Vest: " + Playerweapons.MithrilVest,  PlayerequarmMithrilVest);
  }
  if (Playerweapons.MithrilPlate >= 1)
  {
  Playerequmenuarm.addItem("Mithril Plate: " + Playerweapons.MithrilPlate,  PlayerequarmMithrilPlate);
  }
  if (Playerweapons.GoldPlate >= 1)
  {
  Playerequmenuarm.addItem("Gold Plate: " + Playerweapons.GoldPlate,  PlayerequarmGoldPlate);
  }
  if (Playerweapons.PlatinumPlate >= 1)
  {
  Playerequmenuarm.addItem("Platinum Plate: " + Playerweapons.PlatinumPlate,  PlayerequarmPlatinumPlate);
  }
  if (Playerweapons.AdamantinePlate >= 1)
  {
  Playerequmenuarm.addItem("Adamantine Plate: " + Playerweapons.AdamantinePlate,  PlayerequarmAdamantinePlate);
  }
  if (Playerweapons.AncientPlate >= 1)
  {
  Playerequmenuarm.addItem("Ancient Plate: " + Playerweapons.AncientPlate,  PlayerequarmAncientPlate);
  }
  if (Playerweapons.Cloak >= 1)
  {
  Playerequmenuarm.addItem("Cloak: " + Playerweapons.Cloak,  PlayerequarmCloak);
  }
  if (Playerweapons.CottonRobe >= 1)
  {
  Playerequmenuarm.addItem("Cotton Robe: " + Playerweapons.CottonRobe,  PlayerequarmCottonRobe);
  }
  if (Playerweapons.SilkRobe >= 1)
  {
  Playerequmenuarm.addItem("Silk Robe: " + Playerweapons.SilkRobe,  PlayerequarmSilkRobe);
  }
  if (Playerweapons.DemonPlate >= 1)
  {
  Playerequmenuarm.addItem("Demon Plate: " + Playerweapons.DemonPlate,  PlayerequarmDemonPlate);
  }
  if (Playerweapons.AnglicPlate >= 1)
  {
  Playerequmenuarm.addItem("Anglic Plate: " + Playerweapons.AnglicPlate,  PlayerequarmAnglicPlate);
  }
  
  Playerequmenuarm.addItem("Cancel", Playerequwepexit);
  Playerequmenuarm.execute(6, 34, 272, 160);
}
function PlayerequarmNothing()
{
Player.equiparmourtemp = "Empty";
Player.armoureffecttemp = 0;
PlayerEquipArmPerson();
Menu_Status();
}
function PlayerequarmLh_Armour()
{
Playerweapons.Lh_Armour = Playerweapons.Lh_Armour - 1;
Player.equiparmourtemp = "Leather Armour";
Player.armoureffecttemp = 20;
PlayerEquipArmPerson();
Menu_Status();
}
function PlayerequarmStudLh_Armour()
{
Playerweapons.StudLh_Armour = Playerweapons.StudLh_Armour - 1;
Player.equiparmourtemp = "Studded Leather Armour";
Player.armoureffecttemp = 25;
PlayerEquipArmPerson();
Menu_Status();
}
function PlayerequarmIronPlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.IronPlate = Playerweapons.IronPlate - 1;
  Player.equiparmourtemp = "Iron Plate";
  Player.armoureffecttemp = 32;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmSilverVest()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.SilverVest = Playerweapons.SilverVest - 1;
  Player.equiparmourtemp = "Silver Vest";
  Player.armoureffecttemp = 42;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmSilverPlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.SilverPlate = Playerweapons.SilverPlate - 1;
  Player.equiparmourtemp = "Silver Plate";
  Player.armoureffecttemp = 50;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmSteelPlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.SteelPlate = Playerweapons.SteelPlate - 1;
  Player.equiparmourtemp = "Steel Plate";
  Player.armoureffecttemp = 59;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmBronzeVest()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.BronzeVest = Playerweapons.BronzeVest - 1;
  Player.equiparmourtemp = "Bronze Vest";
  Player.armoureffecttemp = 70;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmBronzePlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.BronzePlate = Playerweapons.BronzePlate - 1;
  Player.equiparmourtemp = "Bronze Plate";
  Player.armoureffecttemp = 77;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmMithrilVest()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.MithrilVest = Playerweapons.MithrilVest - 1;
  Player.equiparmourtemp = "Mithril Vest";
  Player.armoureffecttemp = 95;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmMithrilPlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.MithrilPlate = Playerweapons.MithrilPlate - 1;
  Player.equiparmourtemp = "Mithril Plate";
  Player.armoureffecttemp = 115;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmGoldPlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.GoldPlate = Playerweapons.GoldPlate - 1;
  Player.equiparmourtemp = "Gold Plate";
  Player.armoureffecttemp = 132;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmPlatinumPlate()
{
CheckEquipAbiltiy("Mage");
  if (Player.checkequip == false)
  {
  Playerweapons.PlatinumPlate = Playerweapons.PlatinumPlate - 1;
  Player.equiparmourtemp = "Platinum Plate";
  Player.armoureffecttemp = 152;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmAdamantinePlate()
{
CheckEquipAbiltiy("Bard");
  if (Player.checkequip == false)
  {
  Playerweapons.AdamantinePlate = Playerweapons.AdamantinePlate - 1;
  Player.equiparmourtemp = "Adamantine Plate";
  Player.armoureffecttemp = 202;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmAncientPlate()
{
CheckEquipAbiltiy("Bard");
  if (Player.checkequip == false)
  {
  Playerweapons.AncientPlate = Playerweapons.AncientPlate - 1;
  Player.equiparmourtemp = "Ancient Plate";
  Player.armoureffecttemp = 250;
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmCloak()
{
Playerweapons.Cloak = Playerweapons.Cloak - 1;
Player.equiparmourtemp = "Cloak";
Player.armoureffecttemp = 9;
PlayerEquipArmPerson();
Menu_Status();
}
function PlayerequarmCottonRobe()
{
Playerweapons.CottonRobe = Playerweapons.CottonRobe - 1;
Player.equiparmourtemp = "Cotton Robe";
Player.armoureffecttemp = 17;
PlayerEquipArmPerson();
Menu_Status();
}
function PlayerequarmSilkRobe()
{
Playerweapons.SilkRobe = Playerweapons.SilkRobe - 1;
Player.equiparmourtemp = "Silk Robe";
Player.armoureffecttemp = 35;
PlayerEquipArmPerson();
Menu_Status();
}
function PlayerequarmDemonPlate()
{
CheckEquipAbiltiy("Mage Only");
  if (Player.checkequip == true)
  {
  Playerweapons.DemonPlate = Playerweapons.DemonPlate - 1;
  Player.equiparmourtemp = "Demon Plate";
  Player.armoureffecttemp = 75;
    if (Player.equipperson == "Player1")
    {
    Player.DPlate = true;
    }
    if (Player.equipperson == "Player2")
    {
    Player2.DPlate = true;
    }
    if (Player.equipperson == "Player3")
    {
    Player3.DPlate = true;
    }
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}
function PlayerequarmAnglicPlate()
{
CheckEquipAbiltiy("Mage Only");
  if (Player.checkequip == true)
  {
  Playerweapons.AnglicPlate = Playerweapons.AnglicPlate - 1;
  Player.equiparmourtemp = "Anglic Plate";
  Player.armoureffecttemp = 75;
    if (Player.equipperson == "Player1")
    {
    Player.APlate = true;
    }
    else if (Player.equipperson == "Player2")
    {
    Player2.APlate = true;
    }
    else if (Player.equipperson == "Player3")
    {
    Player3.APlate = true;
    }
  PlayerEquipArmPerson();
  Menu_Status();
  }
  else
  {
  Talk_Window("That person can not equip that!", "blank.png");  
  Playerequipmenu();
  }
}

//Disequip the person's stuff....
function disequipPlayerwep(PersonToDisequip)
{
  if (PersonToDisequip == "Player1")
  {
  Player.disequipweptemp = Player.equipwep;
  }
  if (PersonToDisequip == "Player2")
  {
  Player.disequipweptemp = Player2.equipwep;
  }
  if (PersonToDisequip == "Player3")
  {
  Player.disequipweptemp = Player3.equipwep;
  }
    
  if (Player.disequipweptemp == "Dagger")
  {
  Playerweapons.Dagger = Playerweapons.Dagger + 1;
  }
  if (Player.disequipweptemp == "Dirk")
  {
  Playerweapons.Dirk = Playerweapons.Dirk + 1;
  }
  if (Player.disequipweptemp == "Short Sword")
  {
  Playerweapons.Short_Sword = Playerweapons.Short_Sword + 1;
  }
  if (Player.disequipweptemp == "Mithril Knife")
  {
  Playerweapons.MithrilKnife = Playerweapons.MithrilKnife + 1;
  }
  if (Player.disequipweptemp == "Conqudor Knife")
  {
  Playerweapons.ConqudorKnife = Playerweapons.ConqudorKnife + 1;
  }
  if (Player.disequipweptemp == "Long Sword")
  {
  Playerweapons.Long_Sword = Playerweapons.Long_Sword + 1;
  }
  if (Player.disequipweptemp == "Broad Sword")
  {
  Playerweapons.BroadSword = Playerweapons.BroadSword + 1;
  }
  if (Player.disequipweptemp == "Regal Sword")
  {
  Playerweapons.RegalSword = Playerweapons.RegalSword + 1;
  }
  if (Player.disequipweptemp == "Mithril Blade")
  {
  Playerweapons.MithrilBlade = Playerweapons.MithrilBlade + 1;
  }
  if (Player.disequipweptemp == "Adamantine Blade")
  {
  Playerweapons.AdamantineBlade = Playerweapons.AdamantineBlade + 1;
  }
  if (Player.disequipweptemp == "Legend Sword")
  {
  Playerweapons.LegendSword = Playerweapons.LegendSword + 1;
  }
  if (Player.disequipweptemp == "Wooden Staff")
  {
  Playerweapons.WoodenStaff = Playerweapons.WoodenStaff + 1;
  }
  if (Player.disequipweptemp == "Battle Staff")
  {
  Playerweapons.BattleStaff = Playerweapons.BattleStaff + 1;
  }
  if (Player.disequipweptemp == "Metal Staff")
  {
  Playerweapons.MetakStaff = Playerweapons.MetalStaff + 1;
  }
  if (Player.disequipweptemp == "Mage Staff")
  {
  Playerweapons.MageStaff = Playerweapons.MageStaff + 1;
    if (Player.equipperson == "Player1")
    {
    Player.mattackeffect = Player.mattackeffect - 0.5;
    }
    else if (Player.equipperson == "Player2")
    {
    Player2.mattackeffect = Player2.mattackeffect - 0.5;
    }
    else if (Player.equipperson == "Player1")
    {
    Player3.mattackeffect = Player3.mattackeffect - 0.5;
    }
  }

}
function disequipPlayerarm(PersonToDisequipArm)
{
  if (PersonToDisequipArm == "Player1")
  {
  Player.disequiparmtemp = Player.equiparmour;
  }
  if (PersonToDisequipArm == "Player2")
  {
  Player.disequiparmtemp = Player2.equiparmour;
  }
  if (PersonToDisequipArm == "Player3")
  {
  Player.disequiparmtemp = Player3.equiparmour;
  }
    
  if (Player.disequiparmtemp == "Leather Armour")
  {
  Playerweapons.Lh_Armour = Playerweapons.Lh_Armour + 1;
  }
  if (Player.disequiparmtemp == "Studded Leather Armour")
  {
  Playerweapons.StudLh_Armour = Playerweapons.StudLh_Armour + 1;
  }
  if (Player.disequiparmtemp == "Iron Plate")
  {
  Playerweapons.IronPlate = Playerweapons.IronPlate + 1;
  }
  if (Player.disequiparmtemp == "Silver Vest")
  {
  Playerweapons.SilverVest = Playerweapons.SilverVest + 1;
  }
  if (Player.disequiparmtemp == "Silver Plate")
  {
  Playerweapons.SilverPlate = Playerweapons.SilverPlate + 1;
  }
  if (Player.disequiparmtemp == "Steel Plate")
  {
  Playerweapons.SteelPlate = Playerweapons.SteelPlate + 1;
  }
  if (Player.disequiparmtemp == "Bronze Vest")
  {
  Playerweapons.BronzeVest = Playerweapons.BronzeVest + 1;
  }
  if (Player.disequiparmtemp == "Bronze Plate")
  {
  Playerweapons.BronzePlate = Playerweapons.BronzePlate + 1;
  }
  if (Player.disequiparmtemp == "Mithril Vest")
  {
  Playerweapons.MithrilVest = Playerweapons.MithrilVest + 1;
  }
  if (Player.disequiparmtemp == "Mithril Plate")
  {
  Playerweapons.MithrilPlate = Playerweapons.MithrilPlate + 1;
  }
  if (Player.disequiparmtemp == "Gold Plate")
  {
  Playerweapons.GoldPlate = Playerweapons.GoldPlate + 1;
  }
  if (Player.disequiparmtemp == "Platinum Plate")
  {
  Playerweapons.PlatinumPlate = Playerweapons.PlatinumPlate + 1;
  }
  if (Player.disequiparmtemp == "Adamantine Plate")
  {
  Playerweapons.AdamantinePlate = Playerweapons.AdamantinePlate + 1;
  }
  if (Player.disequiparmtemp == "Ancient Plate")
  {
  Playerweapons.AncientPlate = Playerweapons.AncientPlate + 1;
  }
  if (Player.disequiparmtemp == "Cloak")
  {
  Playerweapons.Cloak = Playerweapons.Cloak + 1;
  }
  if (Player.disequiparmtemp == "Cotton Robe")
  {
  Playerweapons.CottonRobe = Playerweapons.CottonRobe + 1;
  }
  if (Player.disequiparmtemp == "Silk Robe")
  {
  Playerweapons.SilkRobe = Playerweapons.SilkRobe + 1;
  }
  if (Player.disequiparmtemp == "Demon Plate")
  {
    if (Player.equiparmourtemp == "Demon Plate")
    {
    }
    else
    {
      if (Player.equipperson == "Player1")
      {
      Player.DPlate = false;
      }
      if (Player.equipperson == "Player2")
      {
      Player2.DPlate = false;
      }
      if (Player.equipperson == "Player3")
      {
      Player3.DPlate = false;
      }
    }
  Playerweapons.DemonPlate = Playerweapons.DemonPlate + 1;
  }
  if (Player.disequiparmtemp == "Anglic Plate")
  {
    if (Player.equiparmourtemp == "Anglic Plate")
    {
    }
    else
    {
      if (Player.equipperson == "Player1")
      {
      Player.APlate = false;
      }
      if (Player.equipperson == "Player2")
      {
      Player2.APlate = false;
      }
      if (Player.equipperson == "Player3")
      {
      Player3.APlate = false;
      }
    }
  Playerweapons.AnglicPlate = Playerweapons.AnglicPlate + 1;
  }
}
function PlayerEquipWepPerson()
{
Player.mattackeffect = Player.mattackeffect + Player.magicattacktemp;

  if (Player.equipperson == "Player1")
  {
  disequipPlayerwep("Player1")
  Player.equipwep = Player.equipweptemp;
  Player.weaponeffect = Player.weaponeffecttemp;
  Player.attack = Player.str + Player.weaponeffecttemp;
  Player.mattack = Math.floor(Player.mag*Player.mattackeffect);
  Player.weaponthing = Player.weapontempthing;
  }
  else if (Player.equipperson == "Player2")
  {
  disequipPlayerwep("Player2");
  Player2.equipwep = Player.equipweptemp;
  Player2.weaponeffect = Player.weaponeffecttemp;
  Player2.attack = Player2.str + Player.weaponeffecttemp;
  Player2.mattack = Math.floor(Player2.mag*Player2.mattackeffect);
  Player2.weaponthing = Player.weapontempthing;
  }
  else if (Player.equipperson == "Player3")
  {
  disequipPlayerwep("Player3");
  Player3.equipwep = Player.equipweptemp;
  Player3.weaponeffect = Player.weaponeffecttemp;
  Player3.attack = Player3.str + Player.weaponeffecttemp;
  Player3.mattack = Math.floor(Player3.mag*Player3.mattackeffect);
  Player3.weaponthing = Player.weapontempthing;
  }
}
function PlayerEquipArmPerson()
{
  if (Player.equipperson == "Player1")
  {
  disequipPlayerarm("Player1")
  Player.equiparmour = Player.equiparmourtemp;
  Player.armoureffect = Player.armoureffecttemp;
  Player.defence = Player.vit + Player.armoureffecttemp;
  }
  if (Player.equipperson == "Player2")
  {
  disequipPlayerarm("Player2")
  Player2.equiparmour = Player.equiparmourtemp;
  Player2.armoureffect = Player.armoureffecttemp;
  Player2.defence = Player2.vit + Player.armoureffecttemp;
  }
  if (Player.equipperson == "Player3")
  {
  disequipPlayerarm("Player3")
  Player3.equiparmour = Player.equiparmourtemp;
  Player3.armoureffect = Player.armoureffecttemp;
  Player3.defence = Player3.vit + Player.armoureffecttemp;
  }
}
function CheckEquipAbiltiy(PersonClass)
{
Player.checkequip = false;
  if (Player.equipperson == "Player1")
  {
    if (PersonClass == "Mage")
    {
      if (Player.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
    else if (PersonClass == "Bard")
    {
      if (Player.chrclass == "Bard")
      {
      Player.checkequip = true;
      }
      if (Player.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
    else if (PersonClass == "Mage Only")
    {
      if (Player.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
  }   
  else if (Player.equipperson == "Player2")
  {
    if (PersonClass == "Mage")
    {
      if (Player2.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
    else if (PersonClass == "Bard")
    {
      if (Player2.chrclass == "Bard")
      {
      Player.checkequip = true;
      }
      if (Player2.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
    else if (PersonClass == "Mage Only")
    {
      if (Player2.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
  }
  else if (Player.equipperson == "Player3")
  {
    if (PersonClass == "Mage")
    {
      if (Player3.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
    else if (PersonClass == "Bard")
    {
      if (Player3.chrclass == "Bard")
      {
      Player.checkequip = true;
      }
      if (Player3.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
    else if (PersonClass == "Mage Only")
    {
      if (Player3.chrclass == "Mage")
      {
      Player.checkequip = true;
      }
    }
  }
} 
